package com.zhuxulin.tab;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

import com.zhuxulin.tab.bluetooth.PlayMusic;
import com.zhuxulin.tab.listeners.PlayMusicListener;

public class Music extends Activity {
	private Button MusicPlay = null;
	private Button MusicPause = null;
	private PlayMusic playMusic = null;
	private static String TAG=Music.class.getSimpleName();
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_music);
		playMusic=((App)getApplication()).getPlayMusic();
//		playMusic=(playMusic==null?new PlayMusic(this));
//		if(playMusic==null){
//			playMusic=new PlayMusic(getApplication());
//			((App)getApplication()).setPlayMusic(playMusic);
//		}
		MusicPlay = (Button) findViewById(R.id.play);
		MusicPause = (Button) findViewById(R.id.pause);
//		MusicPlay.setOnClickListener(new PlayMusicListener(playMusic));
		MusicPlay.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				playMusic.setPlayFile("/mnt/sdcard/Music/1.mid");
				playMusic.play();
			}
		});
		MusicPause.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				playMusic.pause();
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.play_music, menu);
		return true;
	}

}
